package com.liu.cloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author LIU
 * @version 1.0
 * @description: TODO
 * @date 2023/6/18 12:49
 */
@RestController
@RequestMapping("/stock")
public class StockController {
    @Value("${server.port}")
    private String port;

    /**
     * http://localhost:8088/stock-server/stock/reduce
     * 访问访问
     * @param request
     * @return
     * @throws InterruptedException
     */
    @RequestMapping("/reduce")
    public String reduce(HttpServletRequest request) throws InterruptedException {
        String authorization = request.getHeader("Authorization");
        System.out.println("扣减库存成功 "+ authorization);
//        Thread.sleep(4000);
        return "扣减库存成功，端口号：" + port;
    }

}
